import {createStore, Store, useStore as baseUseStore} from 'vuex';
import {InjectionKey} from 'vue';

import layout from './module/layout'
import user from './module/user'
import customer from './module/customer'

import {IState} from "@/types/vuex";

export const store = createStore<IState>({
  modules: {
    layout,
    user,
    customer,
  }
});

export const key: InjectionKey<Store<IState>> = Symbol("media");

// 定义自己的 `useStore` 组合式函数
export function useStore(): Store<IState> {
  return baseUseStore(key);
}
